import Vue from 'vue'
import App from './App'
import {router} from './router/index'
// import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import iView from 'iview'
import 'iview/dist/styles/iview.css'
import './assets/style/common.css'
import store from './store/index'
import axios from 'axios'
import VideoPlayer from 'vue-video-player'
import videojs from 'video.js'
window.videojs = videojs
require('video.js/dist/video-js.css')
require('vue-video-player/src/custom-theme.css')
require('videojs-contrib-hls/dist/videojs-contrib-hls')
Vue.use(VideoPlayer)
// Vue.use(ElementUI)
Vue.use(iView)
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
// Vue.prototype.$axios = axios

// Vue.config.productionTip = false

// 请求拦截器
axios.interceptors.request.use(
  config => {
    // if (store.state.token) {
    //   config.headers.Authorization = `token ${store.state.token}`
    // }
    config.headers['Content-Type'] = 'application/json;charset=UTF-8'
    // config.headers['Content-Type'] = 'application/x-www-form-urlencoded'
    // config.headers.token = localStorage.getItem('token')  // 将接口返回的token信息配置到接口请求中
    return config
  },
  err => {
    return Promise.reject(err)
  }
)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  components: { App },
  template: '<App/>'
})
